﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace AOuSuisJeWP7
{
    [DataContract]
    public class UserLogin : INotifyPropertyChanged
    {
        private string email;
        private string password;


        //private bool isAuthenticate;
        public bool IsAuthenticate { get; set; }
        //public bool IsAuthenticate
        //{
        //    get { return isAuthenticate; }
        //    set
        //    {
        //        if (Email.Length > 0 && Password.Length > 0 && value == false)
        //        {
        //            throw new Exception("Adresse ou mot de passe incorrect.");
        //        }
        //        isAuthenticate = value;
        //        NotifyPropertyChanged("IsAuthenticate");
        //    }
        //}
        [DataMember]
        public string Email
        {
            get { return email; }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new Exception("L'adresse électronique est nécessaire");
                }
                email = value;
                NotifyPropertyChanged("Email");
            }
        }

        [DataMember]
        public string FbToken
        {
            get;
            set;
        }
        public string Password
        {
            get { return password; }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new Exception("Le mot de passe est nécessaire");
                }
                password = value;
                NotifyPropertyChanged("Password");
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

    }
}
